int height,
double scale,
GError **error);
+GdkTexture *gtk_load_symbolic_texture_from_file (GFile *file);
GdkTexture *gtk_make_symbolic_texture_from_file (GFile *file,
int width,
int height,
double scale,
GError **error);
+GdkTexture *gtk_load_symbolic_texture_from_resource (const char *data);
GdkTexture *gtk_make_symbolic_texture_from_resource (const char *path,
int width,
int height,
char *resource_path = g_uri_unescape_string (uri + strlen ("resource://"), NULL);
if (g_str_has_suffix (uri, ".symbolic.png"))
- recolor->texture = gdk_texture_new_from_resource (resource_path);
+ recolor->texture = gtk_load_symbolic_texture_from_resource (resource_path);
else
recolor->texture = gtk_make_symbolic_texture_from_resource (resource_path, 0, 0, 1.0, NULL);
else
{
if (g_str_has_suffix (uri, ".symbolic.png"))
- recolor->texture = gdk_texture_new_from_file (recolor->file, NULL);
+ recolor->texture = gtk_load_symbolic_texture_from_file (recolor->file);
else
recolor->texture = gtk_make_symbolic_texture_from_file (recolor->file, 0, 0, 1.0, NULL);
}
return pixbuf;
}
+GdkTexture *
+gtk_load_symbolic_texture_from_resource (const char *path)
+{
+ GdkPixbuf *pixbuf;
+ GdkTexture *texture;
+
+ pixbuf = _gdk_pixbuf_new_from_resource (path, "png", NULL);
+ texture = gdk_texture_new_for_pixbuf (pixbuf);
+ g_object_unref (pixbuf);
+
+ return texture;
+}
+
GdkTexture *
gtk_make_symbolic_texture_from_resource (const char *path,
int width,
return texture;
}
+GdkTexture *
+gtk_load_symbolic_texture_from_file (GFile *file)
+{
+ GdkPixbuf *pixbuf;
+ GdkTexture *texture;
+ GInputStream *stream;
+
+ stream = G_INPUT_STREAM (g_file_read (file, NULL, NULL));
+ if (stream == NULL)
+ return NULL;
+
+ pixbuf = _gdk_pixbuf_new_from_stream (stream, "png", NULL, NULL);
+ g_object_unref (stream);
+ if (pixbuf == NULL)
+ return NULL;
+
+ texture = gdk_texture_new_for_pixbuf (pixbuf);
+ g_object_unref (pixbuf);
+
+ return texture;
+}
+
GdkTexture *
gtk_make_symbolic_texture_from_file (GFile *file,
int width,